package com.guoyansoft.model.service.impl;

import com.guoyansoft.config.R;
import com.guoyansoft.model.dao.ShopTypeDao;
import com.guoyansoft.model.pojo.ShopType;
import com.guoyansoft.model.service.ShopTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ShopTypeServiceImpl implements ShopTypeService {
    @Autowired
    private ShopTypeDao shopTypeDao;
    @Override
    public List<ShopType> queryAll() {
        return shopTypeDao.selectAll();
    }


    @Override
    public R queryByPage(Map<String, Object> params)  {
        List<ShopType> empList = shopTypeDao.selectByPage(params);
        long totalSize = shopTypeDao.selectTotalSize(params);
        return R.suc(totalSize,empList);
    }


    @Override
    public boolean dropBatch(Integer[] ids) {
        int row = shopTypeDao.deleteBatch(ids);
        if(row>0){
            return true;
        }
        return false;
    }

    @Override
    public boolean save(ShopType shopType)  {
        int row = shopTypeDao.insert(shopType);
        if(row>0){
            return true;
        }
        return false;
    }


    @Override
    public boolean update(ShopType shopType){
        int row = shopTypeDao.update(shopType);
        if(row>0){
            return true;
        }
        return false;
    }

    @Override
    public ShopType queryById(Integer id) {
        return shopTypeDao.selectById(id);
    }
}
